/**
 * 
 */
package com.mc.easyexcel.read;

import java.io.File;
import java.util.List;
import java.util.Map;

import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.mc.easyexcel.read.ReadSimple.DemoData;

/**
 * @author w.weizhen
 *
 */
public class ReadSimple {
	private static final String read_path = "D:/文件/日期文件/202208080/";//xl文件目录
	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{
		handFirst();
		
//		handSecond();
	}
	
	//处理一个简单的表格文件
	private static void handFirst()
	{
		String name = "municipal_water_quality.xlsx";
		File file = new File(read_path, name);
		List<Map<Integer, String>> listMap = EasyExcel.read(file.getPath()).sheet().doReadSync();
		for (int v = 0; v < listMap.size(); v++) {
            Map<Integer, String> data = listMap.get(v);
            System.out.println();
            for(Map.Entry<Integer, String> entry : data.entrySet())
            {
            	System.out.println(v + "|" + entry.getKey() + "|" + entry.getValue());
            }
            System.out.println();
        }
	}
	
	
	//处理一个简单的表格文件
	private static void handSecond()
	{
		String name = "municipal_water_quality.xlsx";
		File file = new File(read_path, name);
//		List<Map<Integer, String>> listMap = EasyExcel.read(file.getPath()).sheet(readData.class).doReadSync();
		
		List<DemoData> list = EasyExcel.read(file.getPath()).head(DemoData.class).sheet().doReadSync();
		for (int i = 0; i < list.size(); i++) 
		{
			
		}
		
//		for (int v = 0; v < listMap.size(); v++) {
//            Map<Integer, String> data = listMap.get(v);
//            System.out.println();
//            for(Map.Entry<Integer, String> entry : data.entrySet())
//            {
//            	System.out.println(v + "|" + entry.getKey() + "|" + entry.getValue());
//            }
//            System.out.println();
//        }
	}
	
	class DemoData{
		private String x;
		private String y;
		private String z;
		public String getX() {
			return x;
		}
		public void setX(String x) {
			this.x = x;
		}
		public String getY() {
			return y;
		}
		public void setY(String y) {
			this.y = y;
		}
		public String getZ() {
			return z;
		}
		public void setZ(String z) {
			this.z = z;
		}
		@Override
		public String toString() {
			return "readData [x=" + x + ", y=" + y + ", z=" + z + "]";
		}
	}
	
	
	
}